home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / amiga / gccbsrld.lha / gcc-2.1.baserel.diff next >
Text File  |  1992-06-23  |  25KB  |  785 lines

  1. diff -2rcN dh5:gcc-2.1.orig/config/amiga.c gcc-2.1/config/amiga.c
  2. *** dh5:gcc-2.1.orig/config/amiga.c
  3. --- gcc-2.1/config/amiga.c    Sat Apr 18 22:37:16 1992
  4. ***************
  5. *** 0 ****
  6. --- 1,127 ----
  7. + /* amiga.c: Functions for Amiga as target machine for GNU C compiler */
  8. +
  9. + /* NOTE: ATTRIBUTE STUFF IS NOT WORKING CURRENTLY !!!!! */
  10. + #include "m68k.c"
  11. + #include "tree.h"
  12. + struct attribute {
  13. +   tree ident;
  14. +   int  saveds : 1,
  15. +        interrupt : 1;
  16. + };
  17. + static struct attribute *a_tab = 0;
  18. + static int a_index, a_size;
  19. + void
  20. + add_attr_entry (attr)
  21. +     struct attribute *attr;
  22. + {
  23. +   if (! a_tab)
  24. +     {
  25. +       a_size = 10;
  26. +       a_index = 0;
  27. +       a_tab  = (struct attribute *) xmalloc (a_size * sizeof (struct attribute));
  28. +     }
  29. +   if (a_index == a_size)
  30. +     {
  31. +       a_size <<= 1;
  32. +       a_tab = (struct attribute *) xrealloc (a_tab, a_size * sizeof (struct attribute));
  33. +     }
  34. +   a_tab[a_index++] = *attr;
  35. + }
  36. + void
  37. + attr_do_saveds (function_ident)
  38. +       tree function_ident;
  39. + {
  40. +   struct attribute attr, *a;
  41. +   int i;
  42. +   for (i = 0, a = a_tab; i < a_index; i++, a++)
  43. +     if (a->ident == function_ident)
  44. +       {
  45. +     a->saveds = 1;
  46. +     return;
  47. +       }
  48. +   /* create a new entry for this function */
  49. +   attr.ident     = function_ident;
  50. +   attr.saveds    = 1;
  51. +   attr.interrupt = 0;
  52. +   add_attr_entry (&attr);
  53. + }
  54. + void
  55. + attr_do_interrupt (function_ident)
  56. +     tree function_ident;
  57. + {
  58. +   struct attribute attr, *a;
  59. +   int i;
  60. +   for (i = 0, a = a_tab; i < a_index; i++, a++)
  61. +     if (a->ident == function_ident)
  62. +       {
  63. +     /* __interrupt implies __saveds */
  64. +     a->saveds    = 1;
  65. +     a->interrupt = 1;
  66. +     return;
  67. +       }
  68. +   /* create a new entry for this function */
  69. +   attr.ident     = function_ident;
  70. +   attr.saveds     = 1;
  71. +   attr.interrupt = 1;
  72. +   add_attr_entry (&attr);
  73. + }
  74. + int
  75. + attr_does_saveds (function_name)
  76. +     char *function_name;
  77. + {
  78. +   tree ident = get_identifier (function_name);
  79. +   struct attribute *attr;
  80. +   int i;
  81. +   
  82. +   for (i = 0, attr = a_tab; i < a_index; i++, attr++)
  83. +     if (attr->ident == ident)
  84. +       return attr->saveds;
  85. +   return 0;
  86. + }
  87. + int
  88. + attr_does_interrupt (function_name)
  89. +     char *function_name;
  90. + {
  91. +   tree ident = get_identifier (function_name);
  92. +   struct attribute *attr;
  93. +   int i;
  94. +   
  95. +   for (i = 0, attr = a_tab; i < a_index; i++, attr++)
  96. +     if (attr->ident == ident)
  97. +       return attr->interrupt;
  98. +   return 0;
  99. + }
  100. + /* Does operand (which is a symbolic_operand) live in text space? If
  101. +    so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.*/
  102. + int
  103. + read_only_operand (operand)
  104. +      rtx operand;
  105. + {
  106. +   if (GET_CODE (operand) == CONST)
  107. +     operand = XEXP (XEXP (operand, 0), 0);
  108. +   if (GET_CODE (operand) == SYMBOL_REF)
  109. +     return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
  110. +   return 1;
  111. + }
  112. diff -2rcN dh5:gcc-2.1.orig/config/amiga.h gcc-2.1/config/amiga.h
  113. *** dh5:gcc-2.1.orig/config/amiga.h
  114. --- gcc-2.1/config/amiga.h    Sat Apr 18 23:16:53 1992
  115. ***************
  116. *** 0 ****
  117. --- 1,398 ----
  118. + /* Definitions of target machine for GNU compiler.  amiga 68000/68020 version.
  119. +    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  120. + This file is part of GNU CC.
  121. + GNU CC is free software; you can redistribute it and/or modify
  122. + it under the terms of the GNU General Public License as published by
  123. + the Free Software Foundation; either version 2, or (at your option)
  124. + any later version.
  125. + GNU CC is distributed in the hope that it will be useful,
  126. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  127. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  128. + GNU General Public License for more details.
  129. + You should have received a copy of the GNU General Public License
  130. + along with GNU CC; see the file COPYING.  If not, write to
  131. + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  132. + /* This comment is here to see if it will keep amiga's cpp from dying.  */
  133. + #include "m68k.h"
  134. + /* See tm-m68k.h.  7 means 68020 with 68881.  */
  135. + #ifndef TARGET_DEFAULT
  136. + #define TARGET_DEFAULT 0
  137. + #endif
  138. + /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
  139. +    according to the -m flags.
  140. +    This will control the use of inline 68881 insns in certain macros.
  141. +    Also inform the program which CPU this is for.  */
  142. + #if TARGET_DEFAULT & 02
  143. + /* -m68881 is the default */
  144. + #define CPP_SPEC \
  145. + "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
  146. + %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  147. + #else
  148. + /* -msoft-float is the default, assume -mc68000 as well */
  149. + #define CPP_SPEC \
  150. + "%{m68881:-D__HAVE_68881__ }\
  151. + %{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
  152. + #endif
  153. + /* These compiler options take an argument.  We ignore -target for now.  */
  154. + /* #define WORD_SWITCH_TAKES_ARG(STR)    (!strcmp (STR, "target")) */
  155. + /* -m68000 requires special flags to the assembler.  */
  156. + #if TARGET_DEFAULT & 01
  157. + #define ASM_SPEC \
  158. +  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} %{msmall-code:-l} "
  159. + #else
  160. + #define ASM_SPEC \
  161. +  "%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!m68020:-mc68010}} %{msmall-code:-l} "
  162. + #endif
  163. + /* amiga/amigados are the new "standard" defines for the Amiga, MCH_AMIGA
  164. +  * was used before and is included for compatibility reasons */
  165. + #define CPP_PREDEFINES "-Dmc68000 -Damiga -Damigados -DMCH_AMIGA -DAMIGA"
  166. + /* STARTFILE_SPEC to include amiga floating point initialization
  167. +    This is necessary (tr: amiga does it) for both the m68881 and the fpa
  168. +    routines.
  169. +    Note that includes knowledge of the default specs for gcc, ie. no
  170. +    args translates to the same effect as -m68881
  171. +    I'm not sure what would happen below if people gave contradictory
  172. +    arguments (eg. -msoft-float -mfpa) */
  173. + /* for now, we only have a single set of crt0.o, this could change in 
  174. +    the future. */
  175. + #define STARTFILE_SPEC                    \
  176. +   "%{resident:rcrt0.o%s}%{!resident:%{!fbaserel:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}%{fbaserel:%{pg:bgcrt0.o%s}%{!pg:%{p:bmcrt0.o%s}%{!p:bcrt0.o%s}}}}"
  177. + /* Specify library to handle `-a' basic block profiling.
  178. +    Control choice of libm.a (if user says -lm)
  179. +    based on fp arith default and options.  */
  180. + /* for now, no different math libraries exist, there probably *will*
  181. +  * be some in the future. */
  182. + #define LIB_SPEC "%{g:-lg} %{resident:-lbc}%{!resident:%{fbaserel:%{!p:%{!pg:-lbc}}%{p:-lbc_p}%{pg:-lbc_p}}%{!fbaserel:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}}"
  183. + /* if debugging, tell the linker to output amiga-hunk symbols *and*
  184. +  * a BSD compatible debug hunk */
  185. + #define LINK_SPEC "%{g:-amiga-debug-hunk} %{fbaserel:-databss-together} %{resident:-databss-together} "
  186. + #define CC1_SPEC "%{resident:-fbaserel} "
  187. + #define CC1PLUS_SPEC "%{resident:-fbaserel} "
  188. + /* Omit frame pointer at high optimization levels.  */
  189. +   
  190. + #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
  191. + {                                  \
  192. +   if (OPTIMIZE >= 2)                         \
  193. +     flag_omit_frame_pointer = 1;                \
  194. + }
  195. + /* provide a dummy entry for the small-code switch. This is currently only
  196. +    needed by the assembler (explanations: m68k.h) */
  197. + #undef TARGET_SWITCHES
  198. + #define TARGET_SWITCHES  \
  199. +   { { "68020", 5},                \
  200. +     { "c68020", 5},                \
  201. +     { "68881", 2},                \
  202. +     { "bitfield", 4},                \
  203. +     { "68000", -5},                \
  204. +     { "c68000", -5},                \
  205. +     { "soft-float", -0102},            \
  206. +     { "nobitfield", -4},            \
  207. +     { "rtd", 8},                \
  208. +     { "nortd", -8},                \
  209. +     { "short", 040},                \
  210. +     { "noshort", -040},                \
  211. +     { "fpa", 0100},                \
  212. +     { "nofpa", -0100},                \
  213. +     { "sky", 0200},                \
  214. +     { "nosky", -0200},                \
  215. +     { "68040", 0407},                \
  216. +     { "68030", -01400},                \
  217. +     { "68030", 7},                \
  218. +     { "68040-only", 01000},            \
  219. +     { "small-code", 0 },            \
  220. +     { "", TARGET_DEFAULT}}
  221. + /* Every structure or union's size must be a multiple of 2 bytes.  */
  222. + #define STRUCTURE_SIZE_BOUNDARY 16
  223. + /* This is BSD, so it wants DBX format.  */
  224. + #define DBX_DEBUGGING_INFO
  225. + /* Allow folding division by zero.  */
  226. + #define REAL_INFINITY
  227. + /* This is how to output an assembler line defining a `double' constant.  */
  228. + #undef ASM_OUTPUT_DOUBLE
  229. + #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  230. +   {                                    \
  231. +     if (REAL_VALUE_ISINF (VALUE))                    \
  232. +       fprintf (FILE, "\t.double 0r%s99e999\n", (VALUE) > 0 ? "" : "-");    \
  233. +     else if (isnan (VALUE))                        \
  234. +       {                                    \
  235. +     union { double d; long l[2];} t;                \
  236. +     t.d = (VALUE);                            \
  237. +     fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", t.l[0], t.l[1]); \
  238. +       }                                    \
  239. +     else                                \
  240. +       fprintf (FILE, "\t.double 0r%.17g\n", VALUE);            \
  241. +   }
  242. + /* This is how to output an assembler line defining a `float' constant.  */
  243. + #undef ASM_OUTPUT_FLOAT
  244. + #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  245. +   {                                    \
  246. +     if (REAL_VALUE_ISINF (VALUE))                    \
  247. +       fprintf (FILE, "\t.single 0r%s99e999\n", (VALUE) > 0 ? "" : "-");    \
  248. +     else if (isnan (VALUE))                        \
  249. +       {                                    \
  250. +     union { float f; long l;} t;                    \
  251. +     t.f = (VALUE);                            \
  252. +     fprintf (FILE, "\t.long 0x%lx\n", t.l);                \
  253. +       }                                    \
  254. +     else                                \
  255. +       fprintf (FILE, "\t.single 0r%.9g\n", VALUE);            \
  256. +   }
  257. + /* This is how to output an assembler lines defining floating operands.
  258. +    There's no way to output a NaN's fraction, so we lose it.  */
  259. +   
  260. + #undef ASM_OUTPUT_FLOAT_OPERAND
  261. + #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)                \
  262. +   (REAL_VALUE_ISINF ((VALUE))                        \
  263. +    ? asm_fprintf (FILE, "%I0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
  264. +    : (VALUE) == -0.0                            \
  265. +    ? asm_fprintf (FILE, "%I0r-0.0")                    \
  266. +    : asm_fprintf (FILE, "%I0r%.9g", (VALUE)))
  267. + #undef ASM_OUTPUT_DOUBLE_OPERAND
  268. + #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  269. +   (REAL_VALUE_ISINF ((VALUE))                        \
  270. +    ? asm_fprintf (FILE, "%I0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
  271. +    : (VALUE) == -0.0                            \
  272. +    ? asm_fprintf (FILE, "%I0r-0.0")                    \
  273. +    : asm_fprintf (FILE, "%I0r%.17g", (VALUE)))
  274. + /* use A5 as framepointer instead of A6, this makes A6 available as a
  275. +  * general purpose register, and can thus be used without problems in
  276. +  * direct library calls. */
  277. + #undef FRAME_POINTER_REGNUM
  278. + #define FRAME_POINTER_REGNUM 13
  279. + #undef ARG_POINTER_REGNUM
  280. + #define ARG_POINTER_REGNUM 13
  281. + /* we use A4 for this, not A5, which is the framepointer */
  282. + #undef PIC_OFFSET_TABLE_REGNUM
  283. + #define PIC_OFFSET_TABLE_REGNUM 12
  284. + #define STANDARD_INCLUDE_DIR "gcc:include"
  285. + #define MD_STARTFILE_PREFIX  "gcc:lib/"
  286. + /* we do have an ansi-complient c-library ;-) */
  287. + #define HAVE_ATEXIT
  288. + #define HAVE_VPRINTF
  289. + #define HAVE_VFPRINTF
  290. + #define HAVE_PUTENV
  291. + #define HAVE_STRERROR
  292. + #define ENVIRON_SEPARATOR ','
  293. + /* setup a default shell return value for those (gazillion..) programs that
  294. +    (inspite of ANSI-C) declare main() to be void (or even VOID...) */
  295. + #define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
  296. + /* given that symbolic_operand(X), return TRUE if no special
  297. +    base relative relocation is necessary */
  298. + #define LEGITIMATE_BASEREL_OPERAND_P(X) \
  299. +   (flag_pic == 3 && read_only_operand (X))
  300. + #undef LEGITIMATE_PIC_OPERAND_P
  301. + #define LEGITIMATE_PIC_OPERAND_P(X) \
  302. +   (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
  303. + /* Define this macro if references to a symbol must be treated
  304. +    differently depending on something about the variable or
  305. +    function named by the symbol (such as what section it is in).
  306. +    The macro definition, if any, is executed immediately after the
  307. +    rtl for DECL or other node is created.
  308. +    The value of the rtl will be a `mem' whose address is a
  309. +    `symbol_ref'.
  310. +    The usual thing for this macro to do is to a flag in the
  311. +    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  312. +    name string in the `symbol_ref' (if one bit is not enough
  313. +    information).
  314. +    On the Amiga we use this to indicate if a symbol is in text or
  315. +    data space.  */
  316. + #define ENCODE_SECTION_INFO(DECL)\
  317. + do                                    \
  318. +   {                                    \
  319. +     if (TREE_CODE (DECL) == FUNCTION_DECL)                \
  320. +       SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;            \
  321. +     else                                \
  322. +       {                                    \
  323. +     rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'        \
  324. +            ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));        \
  325. +     if (RTX_UNCHANGING_P (rtl) && !MEM_VOLATILE_P (rtl))        \
  326. +       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;                \
  327. +       }                                    \
  328. +   }                                    \
  329. + while (0)
  330. + #if 0
  331. + #undef SELECT_RTX_SECTION
  332. + #define SELECT_RTX_SECTION(MODE, X)                    \
  333. + {                                    \
  334. +   if (!flag_pic || LEGITIMATE_BASEREL_OPERAND_P (X))            \
  335. +     readonly_data_section();                        \
  336. +   else if (LEGITIMATE_PIC_OPERAND_P (X))                \
  337. +     readonly_data_section();                        \
  338. +   else                                    \
  339. +     data_section();                            \
  340. + }
  341. + #else
  342. + #undef SELECT_RTX_SECTION
  343. + #define SELECT_RTX_SECTION(MODE, X) readonly_data_section ();
  344. + #endif
  345. + /* according to varasm.c, RELOC referrs *only* to whether constants (!)
  346. +    are addressed by address. This doesn't matter in baserelative code,
  347. +    so we allow (inspite of flag_pic) readonly_data_section() in that
  348. +    case */
  349. + #undef SELECT_SECTION
  350. + #define SELECT_SECTION(DECL, RELOC)                    \
  351. + {                                    \
  352. +   if (TREE_CODE (DECL) == STRING_CST)                    \
  353. +     {                                    \
  354. +       if (! flag_writable_strings)                    \
  355. +     readonly_data_section ();                    \
  356. +       else                                \
  357. +     data_section ();                        \
  358. +     }                                    \
  359. +   else if (TREE_CODE (DECL) == VAR_DECL)                \
  360. +     {                                    \
  361. +       if ((flag_pic && flag_pic != 3 && RELOC)                \
  362. +       || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL))        \
  363. +     data_section ();                        \
  364. +       else                                \
  365. +     readonly_data_section ();                    \
  366. +     }                                    \
  367. +   else                                    \
  368. +     readonly_data_section ();                        \
  369. + }
  370. + /* starting support for amiga specific keywords (NOT CURRENTLY WORKING!)
  371. +  * --------------------------------------------
  372. +  */
  373. + /* validate attributes that don't take a parameter. Currently we support
  374. +  * __attribute__ (saveds) and __attribute__ (interrupt)
  375. +  */
  376. + #define HANDLE_ATTRIBUTE0(attr) \
  377. +   (strcmp(attr, "saveds") != 0 && strcmp(attr, "interrupt") != 0)
  378. + /* (c-common.c)
  379. +  * install additional attributes
  380. +  */
  381. + #define HANDLE_EXTRA_ATTRIBUTES(a)                         \
  382. +   if (TREE_VALUE (a) != 0                            \
  383. +       && TREE_CODE (TREE_VALUE (a)) == IDENTIFIER_NODE                \
  384. +       && TREE_VALUE (a) == get_identifier ("saveds"))                \
  385. +     {                                        \
  386. +       if (TREE_CODE (decl) != FUNCTION_DECL)                    \
  387. +         {                                    \
  388. +           warning_with_decl (decl,                        \
  389. +               "saveds attribute specified for non-function `%s'");        \
  390. +       return;                                \
  391. +         }                                    \
  392. +                                               \
  393. +       attr_do_saveds (DECL_NAME (decl));                    \
  394. +     }                                        \
  395. +   else if (TREE_VALUE (a) != 0                            \
  396. +       && TREE_CODE (TREE_VALUE (a)) == IDENTIFIER_NODE                \
  397. +       && TREE_VALUE (a) == get_identifier ("interrupt"))            \
  398. +     {                                        \
  399. +       if (TREE_CODE (decl) != FUNCTION_DECL)                    \
  400. +         {                                    \
  401. +           warning_with_decl (decl,                        \
  402. +               "saveds attribute specified for non-function `%s'");        \
  403. +       return;                                \
  404. +         }                                    \
  405. +                                               \
  406. +       attr_do_interrupt (DECL_NAME (decl));                    \
  407. +     }                                        \
  408. + #define PROLOGUE_EXTRA_SAVE(mask)                        \
  409. +   { extern char *current_function_name;                        \
  410. +     /* saveds makes the function preserve d1/a0/a1 as well */            \
  411. +     if (attr_does_saveds (current_function_name))                \
  412. +       mask |= 0x40c0; }                                \
  413. + #define EPILOGUE_EXTRA_RESTORE(mask, nregs)                    \
  414. +   { extern char *current_function_name;                        \
  415. +     /* restore those extra registers */                        \
  416. +     if (attr_does_saveds (current_function_name))                \
  417. +       {                                        \
  418. +     mask |= 0x0302;                                \
  419. +     nregs += 3;                                \
  420. +       } }                                    \
  421. + #define EPILOGUE_EXTRA_BARRIER_KLUDGE(stream)                    \
  422. +   { extern char *current_function_name;                        \
  423. +     /* PLEASE Help! how is this done cleaner?? */                \
  424. +     if (attr_does_saveds (current_function_name))                \
  425. +       {                                        \
  426. +     fprintf (stderr,                             \
  427. +          "warning: couldn't cleanup `saveds'-stack in `%s'.\n");    \
  428. +     fprintf (stderr,                            \
  429. +          "         this is only ok, if the function never returns!\n");    \
  430. +       }    }                                    \
  431. +         
  432. + #define EPILOGUE_EXTRA_TEST(stream)                        \
  433. +   { extern char *current_function_name;                        \
  434. +     /* with the interrupt-attribute, we have to set the cc before rts */    \
  435. +     if (attr_does_interrupt (current_function_name))                \
  436. +       asm_fprintf (stream, "\ttstl %s\n", reg_names[0]); }            \
  437. diff -2rcN dh5:gcc-2.1.orig/config/m68k.c gcc-2.1/config/m68k.c
  438. *** dh5:gcc-2.1.orig/config/m68k.c    Mon Apr 20 02:35:38 1992
  439. --- gcc-2.1/config/m68k.c    Sat Apr 18 21:58:21 1992
  440. ***************
  441. *** 57,61 ****
  442.   finalize_pic ()
  443.   {
  444. !   if (flag_pic && current_function_uses_pic_offset_table)
  445.       emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  446.   }
  447. --- 57,61 ----
  448.   finalize_pic ()
  449.   {
  450. !   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
  451.       emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  452.   }
  453. ***************
  454. *** 205,209 ****
  455.   #endif
  456.       }
  457. !   if (flag_pic && current_function_uses_pic_offset_table)
  458.       {
  459.   #ifdef MOTOROLA
  460. --- 208,212 ----
  461.   #endif
  462.       }
  463. !   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
  464.       {
  465.   #ifdef MOTOROLA
  466. ***************
  467. *** 795,804 ****
  468.     if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
  469.       {
  470.         if (reg == 0)
  471.       abort ();
  472.   
  473. !       pic_ref = gen_rtx (MEM, Pmode,
  474. !              gen_rtx (PLUS, Pmode,
  475. !                   pic_offset_table_rtx, orig));
  476.         current_function_uses_pic_offset_table = 1;
  477.         RTX_UNCHANGING_P (pic_ref) = 1;
  478. --- 807,824 ----
  479.     if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
  480.       {
  481. + #ifdef LEGITIMATE_BASEREL_OPERAND_P
  482. +   if (LEGITIMATE_BASEREL_OPERAND_P (orig))
  483. +     return orig;
  484. + #endif
  485.         if (reg == 0)
  486.       abort ();
  487.   
  488. !       if (flag_pic == 3)
  489. !         pic_ref = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig);
  490. !       else
  491. !         pic_ref = gen_rtx (MEM, Pmode,
  492. !                gen_rtx (PLUS, Pmode,
  493. !                     pic_offset_table_rtx, orig));
  494.         current_function_uses_pic_offset_table = 1;
  495.         RTX_UNCHANGING_P (pic_ref) = 1;
  496. ***************
  497. *** 832,835 ****
  498. --- 852,856 ----
  499.         /* Likewise, should we set special REG_NOTEs here?  */
  500.       }
  501.     return pic_ref;
  502.   }
  503. ***************
  504. *** 1884,1887 ****
  505. --- 1905,1910 ----
  506.               if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
  507.                 fprintf (file, ":l");
  508. +             if ((flag_pic == 3) && (breg == pic_offset_table_rtx))
  509. +               fprintf (file, ":W");
  510.             }
  511.           fprintf (file, "(%s", reg_names[REGNO (breg)]);
  512. ***************
  513. *** 1899,1902 ****
  514. --- 1922,1927 ----
  515.               if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
  516.                 fprintf (file, ":l");
  517. +             if ((flag_pic == 3) && (breg == pic_offset_table_rtx))
  518. +               fprintf (file, ":W");
  519.             }
  520.           if (addr != 0 && ireg != 0)
  521. diff -2rcN dh5:gcc-2.1.orig/config/m68k.h gcc-2.1/config/m68k.h
  522. *** dh5:gcc-2.1.orig/config/m68k.h    Mon Apr 20 02:35:41 1992
  523. --- gcc-2.1/config/m68k.h    Thu Apr 16 20:16:07 1992
  524. ***************
  525. *** 327,333 ****
  526.   
  527.   #define CONDITIONAL_REGISTER_USAGE \
  528. ! {                                               \
  529. !   if (flag_pic)                                 \
  530. !     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;    \
  531.   }
  532.   
  533. --- 327,336 ----
  534.   
  535.   #define CONDITIONAL_REGISTER_USAGE \
  536. ! {                                                \
  537. !   if (flag_pic)                                  \
  538. !     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;     \
  539. !   /* prevent saving/restoring of the base reg */ \
  540. !   if (flag_pic == 3)                 \
  541. !     call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
  542.   }
  543.   
  544. diff -2rcN dh5:gcc-2.1.orig/config/m68k.md gcc-2.1/config/m68k.md
  545. *** dh5:gcc-2.1.orig/config/m68k.md    Mon Apr 20 02:35:51 1992
  546. --- gcc-2.1/config/m68k.md    Thu Apr 16 18:05:26 1992
  547. ***************
  548. *** 705,715 ****
  549.     if (flag_pic && symbolic_operand (operands[1], SImode)) 
  550.       {
  551. !       /* The source is an address which requires PIC relocation.  
  552. !          Call legitimize_pic_address with the source, mode, and a relocation
  553. !          register (a new pseudo, or the final destination if reload_in_progress
  554. !          is set).   Then fall through normally */
  555. !       extern rtx legitimize_pic_address();
  556. !       rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  557. !       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  558.       }
  559.   }")
  560. --- 705,720 ----
  561.     if (flag_pic && symbolic_operand (operands[1], SImode)) 
  562.       {
  563. ! #ifdef LEGITIMATE_BASEREL_OPERAND_P
  564. !       if (flag_pic != 3 || !LEGITIMATE_BASEREL_OPERAND_P (operands[1]))
  565. ! #endif
  566. !       {
  567. !         /* The source is an address which requires PIC relocation.  
  568. !            Call legitimize_pic_address with the source, mode, and a relocation
  569. !            register (a new pseudo, or the final destination if reload_in_progress
  570. !            is set).   Then fall through normally */
  571. !         extern rtx legitimize_pic_address();
  572. !         rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  573. !         operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  574. !       }
  575.       }
  576.   }")
  577. ***************
  578. *** 4588,4592 ****
  579.     "
  580.   {
  581. !   if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  582.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  583.                  force_reg (Pmode, XEXP (operands[0], 0)));
  584. --- 4593,4597 ----
  585.     "
  586.   {
  587. !   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  588.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  589.                  force_reg (Pmode, XEXP (operands[0], 0)));
  590. ***************
  591. *** 4599,4603 ****
  592.     ;; Operand 1 not really used on the m68000.
  593.   
  594. !   "! flag_pic"
  595.     "*
  596.   #ifdef MOTOROLA
  597. --- 4604,4608 ----
  598.     ;; Operand 1 not really used on the m68000.
  599.   
  600. !   "(! flag_pic || flag_pic == 3)"
  601.     "*
  602.   #ifdef MOTOROLA
  603. ***************
  604. *** 4614,4618 ****
  605.     ;; Operand 1 not really used on the m68000.
  606.   
  607. !   "flag_pic"
  608.     "*
  609.     return \"jsr %0\";
  610. --- 4619,4623 ----
  611.     ;; Operand 1 not really used on the m68000.
  612.   
  613. !   "(flag_pic && flag_pic < 3)"
  614.     "*
  615.     return \"jsr %0\";
  616. ***************
  617. *** 4630,4634 ****
  618.     "
  619.   {
  620. !   if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  621.       operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  622.                  force_reg (Pmode, XEXP (operands[1], 0)));
  623. --- 4635,4639 ----
  624.     "
  625.   {
  626. !   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  627.       operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  628.                  force_reg (Pmode, XEXP (operands[1], 0)));
  629. ***************
  630. *** 4641,4645 ****
  631.             (match_operand:SI 2 "general_operand" "g")))]
  632.     ;; Operand 2 not really used on the m68000.
  633. !   "! flag_pic"
  634.     "*
  635.   #ifdef MOTOROLA
  636. --- 4646,4650 ----
  637.             (match_operand:SI 2 "general_operand" "g")))]
  638.     ;; Operand 2 not really used on the m68000.
  639. !   "(! flag_pic || flag_pic == 3)"
  640.     "*
  641.   #ifdef MOTOROLA
  642. ***************
  643. *** 4656,4660 ****
  644.             (match_operand:SI 2 "general_operand" "g")))]
  645.     ;; Operand 2 not really used on the m68000.
  646. !   "flag_pic"
  647.     "*
  648.     return \"jsr %1\";
  649. --- 4661,4665 ----
  650.             (match_operand:SI 2 "general_operand" "g")))]
  651.     ;; Operand 2 not really used on the m68000.
  652. !   "(flag_pic && flag_pic < 3)"
  653.     "*
  654.     return \"jsr %1\";
  655. diff -2rcN dh5:gcc-2.1.orig/expr.c gcc-2.1/expr.c
  656. *** dh5:gcc-2.1.orig/expr.c    Mon Apr 20 02:40:47 1992
  657. --- gcc-2.1/expr.c    Thu Apr 16 21:14:25 1992
  658. ***************
  659. *** 1699,1702 ****
  660. --- 1699,1708 ----
  661.     argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  662.   
  663. + /* how would you do this RIGHT ?? fake a DECL node? dunno... */
  664. + #ifdef ENCODE_SECTION_INFO
  665. +   /* mark it as a function (to be in the text section that is) */
  666. +   SYMBOL_REF_FLAG (fun) = 1;
  667. + #endif
  668.     INIT_CUMULATIVE_ARGS (args_so_far, (tree)0, fun);
  669.   
  670. diff -2rcN dh5:gcc-2.1.orig/toplev.c gcc-2.1/toplev.c
  671. *** dh5:gcc-2.1.orig/toplev.c    Mon Apr 20 02:44:21 1992
  672. --- gcc-2.1/toplev.c    Thu Apr 16 21:34:22 1992
  673. ***************
  674. *** 464,467 ****
  675. --- 464,468 ----
  676.     {"pic", &flag_pic, 1},
  677.     {"PIC", &flag_pic, 2},
  678. +   {"baserel", &flag_pic, 3},
  679.     {"common", &flag_no_common, 0},
  680.     {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
  681.